@charset "utf-8";

// 定义slidermenu的基础构造
@mixin _slidermenu {
    &,
    > .item {
        position: relative;
        // 当yo-slidermenu被应用到yo-list里时，需要重置yo-list item的flex定义
        display: block !important;
        // 清除.item的内补白，交由yo-slidermenu的子项来处理
        padding: 0 !important;
    }
    .front {
        position: relative;
        z-index: 2;
        background-color: #fff;
    }
    .transition {
        @include transition(transform .3s);
    }
    .action {
        position: absolute;
        top: 0;
        bottom: 0;
        right: 0;
        overflow: hidden;
        width: map-get($slidermenu, action-width);
        background-color: map-get($slidermenu, action-bgcolor);
        @include flexbox;
        > .item {
            @include flex;
            @include align;
        }
    }
}

/**
 * @module widget
 * @method yo-slidermenu
 * @version 1.4.0
 * @description 构造yo-slidermenu的自定义使用方法
 * @demo http://doyoe.github.io/Yo/demo/widget/yo-slidermenu.html
 * @param {String} $name 定义扩展名称 <1.4.0>
 * @param {Length} $action-width action宽度 <1.4.0>
 * @param {Color} $action-bgcolor action背景色 <1.4.0>
 */

@mixin yo-slidermenu(
    $name: default,
    $action-width: default,
    $action-bgcolor: default) {
    // 区别是否新增实例还是修改本身
    $name: if($name == default, "", "-#{$name}");
    // 如果值为default，则取config的定义
    @if $action-width == default {
        $action-width: map-get($slidermenu, action-width);
    }
    @if $action-bgcolor == default {
        $action-bgcolor: map-get($slidermenu, action-bgcolor);
    }
    .yo-slidermenu#{$name} {
        > .action {
            @if $action-width != map-get($slidermenu, action-width) {
                width: $action-width;
            }
            @if $action-bgcolor != map-get($slidermenu, action-bgcolor) {
                background-color: $action-bgcolor;
            }
        }
        // 增量扩展
        @content;
    }
}

// 调用本文件时载入slidermenu基础构造
.yo-slidermenu {
    @include _slidermenu;
}